<template>
	<view>
		<view class="" style="display: flex;margin:50upx 70upx;color: #ccc;">
			<view :class="{active:isActive}" @click="Aclick">
				我的发布
			</view>
			<view :class="{active:isActive1}" @click="Aclick1" style="margin: 0upx 40upx 0upx 60upx;">
				我的活动
			</view>
			<view :class="{active:isActive2}" @click="Aclick2" style="margin: 0upx 60upx 0upx 40upx;">
				被赞
			</view>
			<view :class="{active:isActive3}" @click="Aclick3">
				我的关注
			</view>
		</view>
		<!-- 我的发布 -->
		<view v-if="isfabu" style="height: 900upx;margin: 30upx 70upx;">
			<view class="" style="border-bottom: 2upx solid #ccc;margin: 30upx 0upx;" v-for="(item,index) in res" :key="index">
				<view>{{item.label_name}}</view>
				<view class="" style="display: flex;justify-content: space-between;">
					<text style="color: #ccc;">发布时间:{{item.update_time}}</text>
					<text  @click="bianjiclick">编辑</text>
				</view>
			</view>
		</view>
		<view v-if="ishuodong" style="height: 900upx;margin: 30upx 70upx;">
			<view class="" style="border-bottom: 2upx solid #ccc;margin: 30upx 0upx;" v-for="(item,index) in res" :key="index">
				<view>{{item.label_name}}</view>
				<view class="" style="display: flex;justify-content: space-between;">
					<text style="color: #ccc;">发布时间:{{item.update_time}}</text>
					<text  @click="bianjiclick">编辑</text>
				</view>
			</view>
		</view>
		<view v-if="isguanzhu" style="height: 900upx;margin: 30upx 70upx;">
			<view class="" style="border-bottom: 2upx solid #ccc;margin: 30upx 0upx;" v-for="(item,index) in res" :key="index">
				<view>{{item.label_name}}</view>
				<view class="" style="display: flex;justify-content: space-between;">
					<text style="color: #ccc;">发布时间:{{item.update_time}}</text>
					<text  @click="bianjiclick">编辑</text>
				</view>
			</view>
		</view>
		<!-- 我的活动 -->
		<view v-if="isbeizan" style="height: 900upx;margin: 30upx 70upx;">
			<view class="" style="border-bottom: 2upx solid #ccc;margin: 30upx 0upx;">
				<view>美白水润,轻松摸出美白水润美人肌</view>
				<text style="color: #ccc;">发布时间:2019.08.08</text>
				<text style="color: #ccc;margin-left: 120upx;">326被赞</text>
				<text style="margin-left: 50upx;">头像</text>
			</view>
			<view class="" style="border-bottom: 2upx solid #ccc;margin: 30upx 0upx;">
				<view>美白水润,轻松摸出美白水润美人肌</view>
				<text style="color: #ccc;">发布时间:2019.08.08</text>
				<text style="color: #ccc;margin-left: 120upx;">326被赞</text>
				<text style="margin-left: 50upx;">头像</text>
			</view>
		</view>
		<button v-if="isfabu" type="default" style="background-color: #000;color: #fff;width: 550upx;" @click="bianjiclick">+新发布</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isguanzhu:false,
				ishuodong:false,
				isbeizan : false,
				isfabu : true,
				isActive : true,
				isActive1 : false,
				isActive2 : false,
				isActive3 : false,
				res:[],
				user_id:'',
			}
		},
		onLoad:function(){
			uni.showLoading()
			uni.getStorage({
				key: 'user_id',
				success: (res) => {
					this.user_id = res.data
					this.setAjax()
				},
				fail: () => {
					uni.navigateTo({
						url: '../../../index/index'
					});
				}
			});
		},
		methods: {
			setAjax(){
				uni.request({
					url: 'https://cx.mingmeijt.com/Api/Label/index',
					method: 'POST',
					data:{
						user_id: this.user_id
					},
					header:{'Content-Type':'application/x-www-form-urlencoded'},
					success: res => {
						uni.hideLoading()
						this.res = res.data.data.list
						console.log(this.res)
					},
					fail: () => {},
					complete: () => {}
				});
			},
			Aclick : function(){
				this.isbeizan = false
				this.isfabu = true
				this.isguanzhu = false
				this.ishuodong = false
				this.isActive = true
				this.isActive1 = false
				this.isActive2 = false
				this.isActive3 = false
			},
			Aclick1 : function(){
				this.isbeizan = false
				this.isfabu = false
				this.isguanzhu = false
				this.ishuodong = true
				this.isActive = false
				this.isActive1 = true
				this.isActive2 = false
				this.isActive3 = false
			},
			Aclick2 : function(){
				this.isguanzhu = false
				this.ishuodong = false
				this.isbeizan = true
				this.isfabu = false
				this.isActive = false
				this.isActive1 = false
				this.isActive2 = true
				this.isActive3 = false
			},
			Aclick3 : function(){
				this.isguanzhu = true
				this.ishuodong = false
				this.isbeizan = false
				this.isfabu = false
				this.isActive = false
				this.isActive1 = false
				this.isActive2 = false
				this.isActive3 = true
			},
			bianjiclick : function(){
				uni.navigateTo({
				url:'/pagesA/user/shequ/details/details'	
				})
			}
		}
	}
</script>

<style>
 .active {
	 border-bottom: 5upx solid #000;
	 color: #000;
	 }
	 
</style>
